﻿/*-------------------------------------------------------------------------
 * 版权所有：	黑客马拉松
 * 作者：		罗毅
 * 联系方式：	whluoyi@gmail.com
 * 创建时间：	2016/10/29 11:23:16
 * 版本号：		v1.0
 * 用途描述：	日志代理
 *  -------------------------------------------------------------------------*/

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;

namespace SuperMarieApi.Log.LogAgent.Xml
{
    /// <summary>
    /// Xml读取结果
    /// </summary>
    internal class XRow
    {
        /// <summary>
        /// 文本节点名称
        /// </summary>
        public static string XML_CDATA_NAME = "<![CDATA[STRING]]>";
        /// <summary>
        /// 构造杉树
        /// </summary>
        /// <param name="reader"></param>
        public XRow(XReader reader)
        {
            this.KeyValue = new Hashtable(StringComparer.CurrentCultureIgnoreCase);
            this.Reader = reader;
        }
        /// <summary>
        /// Xml节点
        /// </summary>
        public XmlNode Node { get; set; }
        /// <summary>
        /// Xml读取参数
        /// </summary>
        public XReader Reader { get; private set; }
        /// <summary>
        /// 节点名称
        /// </summary>
        public string Name { get; set; }
        /// <summary>
        /// 读取到的值
        /// </summary>
        public Hashtable KeyValue { get; private set; }
    }
    /// <summary>
    /// 数据节点
    /// </summary>
    internal class XNode
    {
        public XNode()
        {
            this.Children = new List<XNode>();
        }
        /// <summary>
        /// Xml节点
        /// </summary>
        public XRow XRow { get; set; }
        /// <summary>
        /// Xml读取参数
        /// </summary>
        public XNode Parent { get; set; }
        /// <summary>
        /// 读取到的值
        /// </summary>
        public List<XNode> Children { get; private set; }
    }



    /// <summary>
    /// Xml读取结果
    /// </summary>
    internal class XTarget<T>
    {
        /// <summary>
        /// Xml节点
        /// </summary>
        public XRow XRow { get; set; }
        /// <summary>
        /// Xml读取参数
        /// </summary>
        public T Instance { get; set; }
    }
}
